#ifndef XCHARTVIEW_H
#define XCHARTVIEW_H

#include <QChartView>
#include "xcustomchart.h"

QT_BEGIN_NAMESPACE
class QWidget;
class QResizeEvent;
QT_END_NAMESPACE

class XChartView : public QChartView
{
    Q_OBJECT
public:
    XChartView(XCustomChart* pChart, QWidget* parent=nullptr);
    virtual ~XChartView();

protected:
    void mousePressEvent(QMouseEvent *event) override;  //重写父类mousePressEvent()
    void mouseMoveEvent(QMouseEvent *event) override;   //重写父类mouseMoveEvent()
    void mouseReleaseEvent(QMouseEvent *event) override;    //重写父类mouseReleaseEvent()

private:
    QPoint m_ptLast;  // 上次鼠标的位置
    XCustomChart* m_chart;  //图表
    bool isPressed; //鼠标按下
};

#endif // XCHARTVIEW_H
